import channel from './channel.coffee'

export hook = []

export New = (监听本页面=false)=>
  l = {}
  channel.addEventListener 'message',({data})=>
    name = data[0]
    await l[name]?(...data[1..])
    return
  if 监听本页面
    hook.push l
  return l

export default New()
